<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>

<!--  附件服务器列表 2010-08-04 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
		<title>附件服务器列表</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
	<script src="<%=path%>/js/resizeIframe.js" type="text/javascript"></script>
	<script language="javascript" src="<%=path %>/js/syAjax.js"></script>
	<script type="text/javascript">
		window.onload = function(){
		parent.location.hash="top";
      	resizeIframe();
      }
      
      //添加附件服务器
      function addEnclosureServer()
      {
        var rtnValue=window.showModalDialog("<%=path %>/baseSet/enclosureServerSet/addEnclosureServer.jsp?t="+new Date(),"","dialogHeight:230px;dialogWidth:300px;help=0;scroll=1;");
        if(rtnValue=='true')
        {
          window.location.href="<%=path %>/findAllEnclosureServerEnclosureServerAction.action";
        }
      }
      
      //修改附件服务器
      function updateEnclosure(enclosureId)
      {
        var rtnValue=window.showModalDialog("<%=path %>/toUpdateEnclosureServerEnclosureServerAction.action?enclosureServer.serverId="+enclosureId+"&t="+new Date(),"","dialogHeight:230px;dialogWidth:300px;help=0;scroll=1;");
        if(rtnValue=="true")
        {
          window.location.href="<%=path %>/findAllEnclosureServerEnclosureServerAction.action";
        }
      }
      
      //删除附件服务器
      function deleteEnclosure(enclosureId)
      {
        syAjax.request("post","<%=path %>/deleteEnclosureServerEnclosureServerAction.action?enclosureServer.serverId="+enclosureId,"",{success:initSuccessResult,fail:onFail,type:'plain'});
      }
      
      function initSuccessResult(response)
      {
        window.location.href="<%=path %>/findAllEnclosureServerEnclosureServerAction.action";
        
      }
      
      var enclosureServerId="${requestScope.basicConfig.value}";
      function changeChoose(enclosureId){
      	enclosureServerId=enclosureId;
      	
      }
      
      function doSubmit(){
      	if(enclosureServerId!=""){
      		syAjax.request("post","<%=path %>/changeEnclosureServerEnclosureServerAction.action?enclosureServer.serverId="+enclosureServerId,"",{success:initSuccessResult,fail:onFail,type:'plain'});
      	}
      }
	</script>

  </head>
  
  <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    
  <tr>
    <td colspan="2" align="left" class="f_5">附件服务器设置</td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#9DD12E"></td>
  </tr>
  <tr>
    <td colspan="2" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="left">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <tr>
        <td align="left" valign="top" class="tb_6 border_2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="91%" height="25" align="left" class="f_7">&nbsp;</td>
            <td width="9%" align="right" nowrap="nowrap">
             
              <img src="<%=path %>/images/icon_12.gif" width="18" height="18" align="absmiddle" /> <a href="javascript:addEnclosureServer();">添加附件服务器</a>
             
            </td>
          </tr>
        </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" valign="top">
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="2" height="24" align="left" background="<%=path %>/images/sywesp_21.gif"><img src="<%=path %>/images/sywesp_20.gif" width="2" height="24" /></td>
                  <td align="left" background="<%=path %>/images/sywesp_21.gif">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="1%">&nbsp;</td>
                      <td width="6%" align="left" class="f_8" nowrap="nowrap">当前选择</td>
                      <td width="21%" align="left" class="f_8"><img src="<%=path %>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />服务器名称</td>
                      <td width="29%" align="left" class="f_8"><img src="<%=path %>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />URL</td>
                    
                      <td width="14%" align="left" class="f_8"><img src="<%=path %>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />操作</td>
                    </tr>
                  </table></td>
                  <td width="4" align="right" background="<%=path %>/images/sywesp_21.gif"><img src="<%=path %>/images/sywesp_22.gif" width="4" height="24" /></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td align="left" valign="top">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="25" align="left" valign="top" class="tb_7">
                   <c:choose>
                     <c:when test="${!empty requestScope.enclosureServerList}">
	                    <c:forEach items="${requestScope.enclosureServerList}" var="enclosure">
	                    <c:if test="${enclosure.status==1}">
                  		<table width="100%" border="0" cellspacing="1" cellpadding="0" style="border-bottom: solid #CCCCCC 1px;">
	                      <tr onmouseover="this.style.backgroundColor='#e4f5ff'" onmouseout="this.style.backgroundColor=''">
		                      <td width="1%">&nbsp;</td>
		                      <td width="6%" align="right" class="f_8" nowrap="nowrap" valign="bottom">
		                      <c:if test="${requestScope.basicConfig!=null && requestScope.basicConfig.value==enclosure.serverId}">
		                      <img src="<%=path %>/images/icon_13.gif" width="16" height="14" />
		                      
		                      </c:if>
		           			
		                      <input name="currentChoose" type="radio" value="" onclick="changeChoose('${enclosure.serverId}');" ${(requestScope.basicConfig!=null && requestScope.basicConfig.value==enclosure.serverId)==true?"checked='true'":""} />
		                      
		                      </td>
		                      <td width="21%" height="25" align="left" valign="bottom" class="f_4">${enclosure.serverName }</td>
		                      <td width="29%" align="left" valign="bottom" class="f_4">${enclosure.outUrl }</td>
		                      <td width="14%" valign="bottom">
        &nbsp;
		                          <a href="javascript:updateEnclosure('${enclosure.serverId }');"><img src="<%=path %>/images/icon_5.gif" width="15" height="16" border="0" alt="编辑${enclosure.serverName }" /></a> &nbsp;
		                          <a href="javascript:deleteEnclosure('${enclosure.serverId  }');" onclick="return window.confirm('确定删除？')"><img src="<%=path %>/images/icon_11.gif" width="12" height="12" border="0" alt="删除${enclosure.serverName }" /></a>
		                   
		                      </td>
	                      </tr>
                 		 </table>
                 		 </c:if>
	                    </c:forEach>
	                    <tr>
                    	  <td colspan="6" align="center" valign="middle"><input type="button" onclick="doSubmit();" value="提交" /></td>
                    	</tr>
                    </c:when>
                    <c:otherwise>
                      <table>
                    	<tr>
                    	  <td colspan="6" align="center" valign="middle"><font color="#CCCCCC">无相关信息</font></td>
                    	</tr>
                      </table>
                    </c:otherwise>
                   </c:choose>
                    </td>
                </tr>
              </table></td>
            </tr>
          <tr>
            <td height="5" colspan="2">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
          </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
</table>
  </body>
</html>
